package com.wondertek.poms.core.filter.impl;

import com.wondertek.poms.core.filter.BaseRuleFilter;
import com.wondertek.poms.core.filter.RuleFilterChain;
import com.wondertek.poms.dao.po.Content;
import com.wondertek.poms.dao.po.IRulePo;
import com.wondertek.poms.dao.po.PcProductRule;
import com.wondertek.poms.dao.po.PrdInfoRule;


/**
 * <p><b>CopyRightScopeFilter Description:</b> 版权授权范围过滤器</p>
 * @author douzi
 * <b>DATE</b> 2019年9月27日 下午4:42:09
 */
public class CopyRightScopeFilter extends BaseRuleFilter {

	@Override
	public void doFilter(IRulePo rule, Content c, RuleFilterChain chain) {
		if (rule instanceof PrdInfoRule) {
			PrdInfoRule r = (PrdInfoRule) rule;
			this.baseFilter(r.getPrdRuleId(), 
					r.getCopyRightScope(), 
					c.getScope(),
					chain, 
					"版权授权范围-Scope");
		} else if (rule instanceof PcProductRule) {
			PcProductRule r = (PcProductRule) rule;
			this.baseFilter(
					r.getId(),
					r.getCopyrightScope() != null ? r.getCopyrightScope() : "",
					c.getScope(),
					chain,
					"版权授权范围-Scope");
		}
		chain.doFilter(rule, c, chain);
	}

}
